<?php
/*
 *@des 后台的基类,此处是判断后台用户是不是登录的
 *@author www.speakphp.com 
 */
class IsloginAction extends AdmincommonAction {
  	public function __construct(){
  		parent::__construct();
  		$this->initLogin();
  	}
  	private function initLogin(){
  		$this->_cookie_data = decode_data(cookie("admin_auth")); //获取cookie数据
  		$this->check_is_login();
  		if($this->_cookie_data['super_admin'] == 0 ){
  			$this->setPermition() ;
  		}
  	}
  	//设置当期登录的用户  有哪些操作权限
  	public function setPermition(){
  		$last_permition = array();
  		$permition =array();
  		$permition_admin = array() ;
  		$role_cache = C("role_cache_path");
  	
  		//用户所属的组有哪些操作权限
  		if(file_exists($role_cache."/cache_role_{$this->_cookie_data['gid']}.inc.php")){
  			require_once  $role_cache."/cache_role_{$this->_cookie_data['gid']}.inc.php" ;
  			$permition = $role_array ;
  		}
  		//当前登录的用户的特殊权限
  		if(file_exists($role_cache."/cache_admin_{$this->_cookie_data['id']}.inc.php")){
  			require_once $role_cache."/cache_admin_{$this->_cookie_data['id']}.inc.php" ;
  			$permition_admin = $admin_perm_array ;
  		}
  		$last_permition = array();
  		if($permition && $permition_admin){
  			$last_permition = array_merge_recursive($permition,$permition_admin);
  		}elseif(!$permition && $permition_admin){
  			$last_permition = $permition_admin ;
  		}elseif($permition && !$permition_admin){
  			$last_permition = $permition ;
  		}else{
  		}
  		
  		if($last_permition){
  			$last_permition = array_unique($last_permition);
  		}
  		$last_permition = delete_str_($last_permition);
  	
  		$this->_url_data = $last_permition ; //权限url数组
  	}
}
